export default{
	// 开启命名空间
	namespaced: true,
	//数据节点
	state: ()=>({
		userInfo:JSON.parse(uni.getStorageSync('userInfo') || '{}'),
		address:JSON.parse(uni.getStorageSync('address') || '{}'),
		// token:'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo',
		token:'',
		redirectInfo: {}
	}),
	
	mutations:{
		setAddress(state,provider){
			state.address = provider
			this.commit('m_user/saveToStorage')
		},
		saveToStorage(state){
			uni.setStorageSync('address',JSON.stringify(state.address))
		},
		updateUserInfo(state,provider){
			state.userInfo = provider
			uni.setStorageSync('userInfo',JSON.stringify(state.userInfo))
		},
		updateRedirectInfo(state,info){
			state.redirectInfo = info
			console.log(state.redirectInfo);
		}
	},
	
	getters:{
		addStr(state){
			if(!state.address.provinceName) return ''
			return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
		}
	}
}